//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IDeviceCallback.h>
///	@path	~/src/graphics/
///	@date	2007/09/28
///	@desc	Device callback interface.

#pragma once

#include "xeres.h"

#include "object/IObject.h"

#include "graphics/IDevice.h"
#include "graphics/animation/frame.h"

namespace xeres {

	/*!
		\class	IDeviceCallback
		\brief	Presents Device callback interface.
		
		\sa	IDevice
	*/
	class IDeviceCallback : public IObject
	{
	public:

		/// \name Constructor & Destructor
		//@{

		/// \ctor
		IDeviceCallback( void );

		/// \dtor
		virtual ~IDeviceCallback( void );

		//@}

		DECL_IOBJECT_INTERFACE( IDeviceCallback , IObject );

	public:

		/// \name Device Callbacks
		//@{

		/*!
			\brief		Tick call, give a chance to update device states.
		*/
		virtual void Tick( const Frame& frame ) = 0;

		/*!
			\brief		Call before change mode.
			\return		Result of callback.
			\param[in]	device		Device instance.
			\param[in]	oldSettings	Old device settings.
			\param[in]	newSettings	New device settings.
		*/
		virtual bool PreChangeMode( RefWeak<IDevice> device , void * oldSettings , void * newSettings ) = 0;

		/*!
			\brief		Call after change mode.
			\return		Result of callback.
			\param[in]	device		Device instance.
			\param[in]	settings	Settings after change mode.
		*/
		virtual bool PostChangeMode( RefWeak<IDevice> device , void * settings ) = 0;

		/*!
			\brief		Call when losing device.
			\return		Result of callback.
			\param[in]	device		Device instance.
			
		*/
		virtual bool OnLostDevice( RefWeak<IDevice> device ) = 0;

		/*!
			\brief		Call while reseting device.
			\return					Result of callback.
			\param[in]	device		Device instance.
		*/
		virtual bool OnResetDevice( RefWeak<IDevice> device ) = 0;

		/*! 
			\brief		Call before resizing swap chain.
			\return					Result of callback.
			\param[in]	device		Device instance.
		*/
		virtual bool OnResizingSwapchain( RefWeak<IDevice> device ) = 0;

		/*! 
			\brief		Call after resized swap chain.
			\return					Result of callback.
			\param[in]	device		Device instance.
		*/
		virtual bool OnResizedSwapchain( RefWeak<IDevice> device ) = 0;

		/*!
			\brief		Call when destroying device.
			\return		Result of callback.
			\param[in]	device		Device instance.
		*/
		virtual bool OnDestroyDevice( RefWeak<IDevice> device ) = 0;

		//@}
	};

} // namespace xeres
